package shuzupaixu数组排序;
/**
 * 二维数组：
 * 1、定义：类型[][] 数组名=new 类型[行数][列数]；
 * int [][] a:或int[] a[];或int a[][];
 * 2、元素引用：
 * 数组名[行号][列号]
 *
 */
public class EShuZu二维数组 {

	public static void main(String[] args) {
		int[][] a=new int[5][5];			
		a[1][2]=5;
		a[2][2]=3;
		
		int [][] b;
		b=new int[3][];
		b[0]=new int[2];
		b[1]=new int[5];
		b[2]=new int[3];
		
		
		//杨辉三角
		int[][] a = new int[6][];
		for (int i = 0; i < a.length; i++) {
			a[i] = new int[i + 1];
			a[i][0] = 1;
			a[i][i] = 1;
		}
		for (int i = 2; i < a.length; i++)
			for (int j = 1; j < i; j++)
				a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
		out(a);
	}

	private static void out(int[][] a) {
		for(int i=0;i<a.length;i++){
			for(int j=0;j<a[i].length;j++)
				System.out.print(a[i][j]+"\t");			
		System.out.println();
		
		}
	}

}
